//
//  GLAFLoadRequest.m
//  微他
//
//  Created by apple on 14-10-2.
//  Copyright (c) 2014年 apple. All rights reserved.
//

#import "GLAFLoadRequest.h"
#import "GLAFRequest.h"

@implementation GLAFLoadRequest

+(void)startloadrequest:(NSString *)url
                 params:(NSDictionary *)params
                 dialog:(BOOL)ishow
              loadfirst:(BOOL)loadfirst
          handleSuccess:(BOOL(^)(id, NSDictionary *))handleSuccess
                 loadDB:(void (^)(NSDictionary *))loadDB
            netWorkFail:(void (^)(NSDictionary *))netWorkFail
            doFinally:(void (^)(NSDictionary *))doFinally{
    
    if (loadfirst==YES) {
        //
        loadDB(params);
    }
    
    [GLAFRequest startRequest:url paramsDic:(NSDictionary *) params defaultdialog:ishow handleSuccess:^(id sta, NSDictionary *paramsDic) {
        //
        BOOL hand=handleSuccess(sta,paramsDic);
        if (hand) {
            loadDB(paramsDic);
        }
    } netWorkFail:^(NSDictionary *paramsDic) {
        //
        netWorkFail(params);
    } doFinally:^(NSDictionary *paramsDic) {
        //
        doFinally(paramsDic);
    }];
    
}
@end
